package com.cinematicketscaning.app.controller

import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.transition.Explode
import android.transition.Fade
import android.view.Window
import android.view.WindowManager
import com.cinematicketscaning.app.R
import com.cinematicketscaning.app.controller.base.BaseActivity
import com.cinematicketscaning.app.utils.Utils
import kotlinx.android.synthetic.main.activity_screen_protector.*
import java.util.*

class ScreenProtectorActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        with(window) {
            setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
        }
        setContentView(R.layout.activity_screen_protector)
        layout.setOnTouchListener { _, _ ->
            finish()
            overridePendingTransition(R.anim.activity_open, R.anim.activity_close)
            true
        }
    }

    override fun isUseTimeReceiver(): Boolean {
        return true
    }

    override fun updateTime() {
        val calendar = Utils.initCalendar()
        val hours = calendar.get(Calendar.HOUR_OF_DAY)
        val minutes = calendar.get(Calendar.MINUTE)
        tv_time.text = Utils.getFormatDay(hours) + ":" + Utils.getFormatDay(minutes)
    }
}
